package com.lcxedu.notebook.service.impl;

import com.lcxedu.notebook.entity.Event;
import com.lcxedu.notebook.entity.EventWithCategory;
import com.lcxedu.notebook.mapper.EventMapper;
import com.lcxedu.notebook.service.EventMapperService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Title: EventMapperServiceImpl
 * @Author: 李晨曦
 * @Date: 2025/6/11
 * 好好看 好好学 都能学会 都能学好
 * 我亦无他 唯手熟尔
 */
@Service
public class EventMapperServiceImpl implements EventMapperService {

    @Resource
    private EventMapper eventMapper;


    @Override
    public List<EventWithCategory> getAllEventsWithCategoriesByUserId(Integer userId) {
        return eventMapper.getAllEventsWithCategoriesByUserId(userId);
    }

    @Override
    public void deleteById(Integer id) {
        // 只删除event表的数据，不影响其他表
        eventMapper.deleteById(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Event record) {
        return eventMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int insertSelective(Event record) {
        return eventMapper.insertSelective(record);
    }

    @Override
    public List<EventWithCategory> getAllEventsWithCategoriesByPage(Integer userId, String keyword) {
        return eventMapper.getAllEventsWithCategoriesByPage(userId, keyword);
    }
    @Override
    public List<EventWithCategory> getAllEventsWithCategoriesByCondition(Integer userId, String title, Integer categoryId, String level, String status) {
        return eventMapper.getAllEventsWithCategoriesByCondition(userId, title, categoryId, level, status);
    }
}
